{extend name="base"/}
{block name="title"}
首页
{/block}
{block name="css"}
<link rel="stylesheet" href="__MOBILE__/css/wangStyle.css"/>
<style>
    .layui-flow-more{display: none;}
    #add{    text-align: center;}
    input::-webkit-input-placeholder { color: #fff; } 
    input:-moz-placeholder {color: #fff;} 
    input::-moz-placeholder {color: #fff;} 
    input:-ms-input-placeholder {  color: #fff;} 
</style>
{/block}
{block name="content"}
<!-- 轮播图 -->
<div class="swiper-container myimg">
    <div class="swiper-wrapper imgbox">
        {volist name='imgs' id='vo'}
        <div class="swiper-slide"><img src="{$vo.img}"></div>
        {/volist}
    </div>
    <div class="swiper-pagination"></div>
    <div class="search">
        <div class="topsearch">
            <img src="__MOBILE__/images/search.png" alt="" onclick="sub()">
            <input type="text" id="good_name" placeholder="商品名称">
        </div>
        <a href="{:url('/langjinmobile/my/usermessage')}">
            <img src="__MOBILE__/images/xiaoxi.png" alt="">
        </a>
    </div>
</div>
<!-- 商品分类 -->
<div class="fenlei_bg clearfix">
    <div class="dp_fenlei">
        <ul class="w_shang">
            {volist name='goods_category' id='category'}
            <li><a href="{:url('/langjinmobile/home/search',['cat_id' =>$category.cat_id])}"><img src="{$category.thumb}">{$category.cat_name}</a></li>
            {/volist}
            <li><a href="{:url('/langjinmobile/classify/index')}"><img src="__MOBILE__/images/product-10.png">{:lang('全部分类')}</a></li>
        </ul>
    </div>
</div>
<!-- 公告 -->
<div class="notice">
    <a href="javascript:;">
        <div class="notice_left"><img src="__MOBILE__/images/notice.gif"></div>
        <div class="notice_right">
            <ul style="margin-top: 0px;">
                {volist name='notice' id='vo'}
                    <li><a href="{:url('/langjinmobile/my/messagedetails',['id'=>$vo.id])}">{$vo.title}</a></li>
                {/volist}  
            </ul>
        </div>
    </a>
</div>
<!-- 产品 -->
<a class="product" href="javascript:;" onclick="xingji()">
    <img src="__MOBILE__/images/starbg.png">
</a>
<!-- 商品 -->
<div class="w_store_product">
    <div class="love">
        <hr class="hr_left">
        <span>猜你喜欢</span>
        <hr class="hr_right">
    </div>
    <ul class="clearfix flow-default" id="LAY_demo1">
        {volist name='goods_list' id='list'}
        <li>

            <a href="{:url('/langjinmobile/card/goodsdata',['good_id'=>$list.id])}">
                <img src="{$list.img1}">
                <p class="w_text">{$list.name}</p>
                <p class="w_money">￥{$list.wallet_num}+{$list.integral_num}GMOD</p>

            </a>
        </li>
        {/volist}
        
    </ul>
    <p id="add" class="addmore"></p>
</div>
<!-- 底部 -->
<div class="footer">
	<a href="{:url('/langjinmobile/home/index')}" class="active">
		<img src="__MOBILE__/images/footer2.png" alt="">
		<p>首页</p>
	</a>
	<a href="{:url('/langjinmobile/classify/index')}">
		<img src="__MOBILE__/images/footer3.png" alt="">
		<p>分类</p>
	</a>
	<a href="{:url('/langjinmobile/card/shopcard')}">
		<img src="__MOBILE__/images/footer5.png" alt="">
		<p>购物车</p>
	</a>
	<a href="{:url('/langjinmobile/my/my')}">
		<img src="__MOBILE__/images/footer7.png" alt="">
		<p>我的</p>
	</a>
</div>
{/block}
{block name="js"}
<script>
$(function () {
    // 轮播图
    var mySwiper = new Swiper(".swiper-container",{
    direction:"horizontal",
    loop:true,
    pagination:".swiper-pagination",
    autoplay:2000,
    autoplayDisableOnInteraction : false,
    });
})
</script>
<!-- 公告 -->
<script type="text/javascript">
    function xingji(){
        var user_grade = {$user_grade};
        if(user_grade == 9){
            layer.msg('您已经是九星会员了');
            return false;
        }else{
            window.location.href = '/langjinmobile/card/goodsinfo/level_id/'+(user_grade+1);
        }
    }
	function autoScroll(obj){  
	  $(obj).find("ul").animate({  
		  marginTop : "-.6rem"  
	  },700,function(){  
		  $(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
	  });  
  }  
  $(function(){  
	  setInterval('autoScroll(".notice_right")',2000);
  })
    function sub(){
        var good_name =$("#good_name").val();
        window.location.href = '/langjinmobile/home/search/good_name/'+good_name;
    }
</script>
<script>
    layui.use('flow', function(){
        var flow = layui.flow;

        flow.load({
            elem: '#LAY_demo1' //流加载容器
            ,done: function(page, next){ //执行下一页的回调

                //模拟数据插入
                setTimeout(function(){
                    var lis = [];
                    page++;
                    $.ajax({
                        type: 'POST',
                        url: '/langjinmobile/home/goodsload',
                        data: {page: page},
                        dataType: 'json',
                        success: function (data) {
                            var str = "";
                            if (data.status == 1) {
                                $.each(data.data,function (key,value) {
                                    url = '/langjinmobile/card/goodsdata/good_id/'+value.id;
                                    str += '<li><a href="'+url+'">'
                                    str +='<img src="'+value.img1+'">'
                                    str +='<p class="w_text">'+value.name+'</p>'
                                    str +='<p class="w_money">￥'+value.wallet_num+'+'+value.integral_num+'GMOD</p>'
                                    str +='</a></li>'
                                });
                                $("#LAY_demo1").append(str);
                                // lis.push(str)
                            } else {
                                $("#add").html("{:lang('没有更多记录了')}...");
                            }
                        }
                    });

                    //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                    // pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                    next(lis.join(''), page <= {$num}); //假设总页数为 10
                }, 200);
            }
        });
    });
</script>
<!-- 上拉加载(去team拉吧，兄弟) -->

{/block}